<!DOCTYPE html >
<html>

	<head>
		<meta charset="UTF-8">
		<title>jQuery实现CheckBox全选、全不选</title>
		<script src="../js/jQuery-1.8.3.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function() {
				$("#checkAll").click(function() {
					$('input[name="subBox"]').attr("checked", this.checked);
				});

			});
		</script>

	</head>

	<body>
		<div>
			<input id="checkAll" type="checkbox" />全选
			<input name="subBox" type="checkbox" />1
			<input name="subBox" type="checkbox" />2
			<input name="subBox" type="checkbox" />3
			<input name="subBox" type="checkbox" />4
		</div>
	</body>